package com.mcxx.modules.miniSalvation.order.service.read;

import com.mcxx.modules.base.utils.QueryParamUtil;
import com.mcxx.modules.miniSalvation.family.dto.FuneralDTO;
import com.mcxx.modules.miniSalvation.family.dto.FuneralExcelDTO;
import com.mcxx.modules.miniSalvation.family.dto.SalvationObjectDTO;
import com.mcxx.modules.miniSalvation.family.entity.FuneralEntity;
import com.mcxx.modules.miniSalvation.fundpay.dto.FundPayExcelDto;
import com.mcxx.modules.miniSalvation.fundpay.param.FundPayParam;
import com.mcxx.modules.miniSalvation.order.dao.read.FuneralReadDao;
import com.mcxx.modules.miniSalvation.order.param.FuneralParam;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@TaTransactional(readOnly = true)
public class FuneralReadService {

    @Autowired
    private FuneralReadDao funeralReadDao;


    public List<FuneralEntity> listAll() {
    	return funeralReadDao.listAll();
    }



    public FuneralEntity getById(String id) {
    	return funeralReadDao.getById(id);
    }



    public Page listByCondition(FuneralParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        funeralReadDao.beginPager(pageParam);
        List<FuneralDTO> list = funeralReadDao.listByCondition(param);


        return funeralReadDao.endPager(list);
    }


    public FuneralDTO getFuneralById(String id) {
        return funeralReadDao.getFuneralById(id);
    }


    public FuneralEntity getByMemberId(String memberId) {
        return funeralReadDao.getByMemberId(memberId);
    }


    public Page listDeadObject(FuneralParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        funeralReadDao.beginPager(pageParam);
        List<SalvationObjectDTO> list = funeralReadDao.listDeadObject(param);


        return funeralReadDao.endPager(list);
    }


    public List<FuneralExcelDTO> exportExFuneralList(FuneralParam param){ return funeralReadDao.exportExFuneralList(param); }


    public Page getFuneralCountyExpenseList(FuneralParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        funeralReadDao.beginPager(pageParam);
        List<FuneralDTO> list = funeralReadDao.getFuneralCountyExpenseList(param);


        return funeralReadDao.endPager(list);
    }


    public Page getFuneralCountyQueryList(FuneralParam param, PageParam pageParam, UserAccountVo accountVo) {

        QueryParamUtil.setBaseParamValue(param,accountVo);


        funeralReadDao.beginPager(pageParam);
        List<FuneralDTO> list = funeralReadDao.getFuneralCountyQueryList(param);


        return funeralReadDao.endPager(list);
    }


    public List<FuneralExcelDTO> exportExcelFuneralSettle(FuneralParam param){ return funeralReadDao.exportFuneralCountyQueryList(param); }
}
